package com.ruoyi.dgdData.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.dgdData.domain.plat.DataDgdZhdl;
import com.ruoyi.dgdData.service.IDataDgdZhdlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单轨吊制动力测试数据Controller
 * 
 * @author ruoyi
 * @date 2023-12-28
 */
@RestController
@RequestMapping("/dgd/zhdl")
@Api(value="单轨吊测试",tags = "单轨吊制动力测试接口")
public class DataDgdZhdlController extends BaseController
{
    @Autowired
    private IDataDgdZhdlService dataDgdZhdlService;

    /**
     * 查询单轨吊制动力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:list')")
    @GetMapping("/list")
    @ApiOperation(value="查询单轨吊制动力测试数据列表")
    public TableDataInfo list(DataDgdZhdl dataDgdZhdl)
    {
        startPage();
        List<DataDgdZhdl> list = dataDgdZhdlService.selectDataDgdZhdlList(dataDgdZhdl);
        return getDataTable(list);
    }

    /**
     * 导出单轨吊制动力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:export')")
    @Log(title = "单轨吊制动力测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataDgdZhdl dataDgdZhdl)
    {
        List<DataDgdZhdl> list = dataDgdZhdlService.selectDataDgdZhdlList(dataDgdZhdl);
        ExcelUtil<DataDgdZhdl> util = new ExcelUtil<DataDgdZhdl>(DataDgdZhdl.class);
        util.exportExcel(response, list, "单轨吊制动力测试数据数据");
    }

    /**
     * 获取单轨吊制动力测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:query')")
    @GetMapping(value = "/{zhdlId}")
    public AjaxResult getInfo(@PathVariable("zhdlId") Long zhdlId)
    {
        return success(dataDgdZhdlService.selectDataDgdZhdlByZhdlId(zhdlId));
    }

    /**
     * 新增单轨吊制动力测试数据
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:add')")
    @Log(title = "单轨吊制动力测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataDgdZhdl dataDgdZhdl)
    {
        return toAjax(dataDgdZhdlService.insertDataDgdZhdl(dataDgdZhdl));
    }

    /**
     * 修改单轨吊制动力测试数据
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:edit')")
    @Log(title = "单轨吊制动力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataDgdZhdl dataDgdZhdl)
    {
        return toAjax(dataDgdZhdlService.updateDataDgdZhdl(dataDgdZhdl));
    }

    /**
     * 修改单轨吊制动力测试数据
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:edit')")
    @Log(title = "单轨吊制动力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/editZhdl/{zhdlId}")
    @ApiOperation(value="修改单轨吊制动力测试数据")
    public AjaxResult editZhdl(@PathVariable Long zhdlId)
    {
        return toAjax(dataDgdZhdlService.updateDataDgdZhdlByZhdlId(zhdlId));
    }

    /**
     * 删除单轨吊制动力测试数据
     */
    @PreAuthorize("@ss.hasPermi('dgd:zhdl:remove')")
    @Log(title = "单轨吊制动力测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zhdlIds}")
    public AjaxResult remove(@PathVariable Long[] zhdlIds)
    {
        return toAjax(dataDgdZhdlService.deleteDataDgdZhdlByZhdlIds(zhdlIds));
    }
}
